/*
题目链接:https://leetcode.cn/problems/minimum-cost-to-make-all-characters-equal/?envType=daily-question&envId=2025-03-27
*/

//题解代码:
class Solution {
public:
    long long minimumCost(string s) {
        long long ans = 0;
        int n = s.size();
        for(int i=1;i<n;++i){
            if(s[i] != s[i-1]) ans += min(i,n-i);
        }
        return ans;
    }
};
